package com.designpatterns.factorypattern.simplefactory;

/**
 * 普通工厂模式，一个工厂生产所有产品
 */
public class SimpleProductFactory {
    public static IProduct createProduct(String productNo) throws Exception {
        switch (productNo){
            case "1":return new Product1();
            case "2":return new Product2();
            case "3":return new Product3();
            default:throw new Exception("不支持此编号的产品生产");
        }
    }
}
